<?php
namespace app\common\model\tyyh;

class UserCart extends CUBase {
	protected $privacyFields = ['createtime', 'updatetime'];
	protected $append = ['store', 'product', 'product_specs'];

	//获取购物车店铺信息
    public function getStoreAttr($value, $data) {
        return loadModel('tysj\\Store')->where(['id' => $data['sid']])->field('id,photo,name,type')->find();
    }

    //获取购物车商品信息
    public function getProductAttr($value, $data) {
    	return loadModel('tysj\\Product')->where(['id' => $data['pid']])->field('id,photo,name,selling')->find();
    }

    //获取购物车商品规格信息
    public function getProductSpecsAttr($value, $data) {
    	return loadModel('tysj\\ProductSpecs')->where(['id' => $data['psid']])->field('id,name,price,inventory,weight,volume,min_purchase_quantity')->find();
    }
}